#pragma once
#include "def.h"
#include "context.h"
#include "ActionApiBase.h"
#include "agencyevent.h"

struct CancelPurchaseOrderInfo
{
    std::int64_t purchase_time;
    std::uint64_t order_id;
    std::int64_t fee;
    std::uint64_t cycle;
    CancelPurchaseOrderInfo(): purchase_time(0), order_id(0), fee(0), cycle(0) {}
};

struct CancelPurchaseRegParam
{
    std::uint32_t user_id;
    std::string username;
    std::uint32_t agency_id;
    std::uint32_t game_id;
    std::int64_t balance;
    std::uint64_t order_id;
    std::uint32_t scene_from;
    std::vector<CancelPurchaseOrderInfo> dest_order_list;
    
    std::string agency_name;
    std::string currency;
    std::int64_t currency_unit_multi;

    // ✅ 正确的列表初始化
    CancelPurchaseRegParam() :
        user_id{0},
        username{},
        agency_id{0},
        game_id{0},
        balance{0},
        order_id{0},
        scene_from{0},
        dest_order_list{},
        agency_name{},
        currency{},
        currency_unit_multi{0}
    {}
};


class ActionCancelPurchaseReq : public ActionApiBase
{
public:
    static bool Init();
    
public:
    static void HandleCancelPurchaseReq(MsgData&& msg_data);

public:
    static void OnAgencyGet(std::int32_t err_code, stAgencyEvent* agency, std::string&& trans);

protected:
    static void Request(
        const std::string& baseurl, const std::string& trans,
        std::uint32_t uid, std::uint16_t svtype, std::uint32_t svid, 
        std::uint32_t uuid, const CancelPurchaseRegParam& params);

};